#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
    vector<int> singleNumber(vector<int>& nums) {
        vector<int> n;
        n.resize(2, 0);
        int begin, end;
        sort(nums.begin(), nums.end());
        begin = end = 0;
        int count = 0;
        size_t i = 0;
        for (i = 0; i < nums.size(); i++) {
            if (nums[begin] != nums[end]) {
                if (end - begin == 1) {
                    n[count++] = nums[begin];
                }
                begin = end;
            }
            end++;
        }
        if (begin == nums.size()-1) {
            n[count++] = nums[begin];
        }
        return n;
    }
};
int main() {
    vector<int> v1;
    v1.push_back(1);
    v1.push_back(2);
    v1.push_back(1);
    v1.push_back(3);
    v1.push_back(2);
    v1.push_back(5);

    vector<int> v2 = Solution().singleNumber(v1);
    for (auto e : v2) {
        cout << e << " ";
    }
    cout << endl;
    return 0;
}